# -*- coding: utf-8 -*-
"""
------------------------------------------------------------------------------
    File Name:  string_utils
    Author   :  wanwei1029
    Date     :  2019/5/12
    Desc     :
------------------------------------------------------------------------------
"""


def is_not_blank(string_val):
    return bool(string_val and string_val.strip())


def is_blank(string_val):
    return not is_not_blank(string_val)


def tokenize(data_list, split_char=" "):
    """
    简单将语料按特定字符分词，默认空格
    :param data_list:
    :param split_char:
    :return:
    """
    return [[word for word in raw_data.split(split_char) if is_not_blank(word)] for raw_data in data_list]



def demo():
    """
    """
    print(is_blank(""))
    print(is_blank("  "))
    print(is_blank(None))
    print(is_blank("ab"))
    print(is_blank("\n"))
    print(is_blank("\t"))


if __name__ == '__main__':
    test_method = "tokenize"
    if test_method == "demo":
        demo()
    elif test_method == "tokenize":
        test_list = list()
        test_list.append("今天#是个#好 天气")
        print(tokenize(test_list, "#"))
